
const express = require("express");
const path = require("path");

const bodyParser = require("body-parser");

let app = express();
app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json());

app.get("/",(req,res)=>{
    res.sendFile(path.join(__dirname,"./views/index.html") );
})

app.get("/getdata",(req,res)=>{
    console.log(req.query);
    // setTimeout(() => {
        res.json({
            info:"我是3000端口下的数据1"
        })
    // }, 3000);
    
})


app.post("/getpostdata",(req,res)=>{
    console.log(req.body);
    res.json({
        info:"我是3000端口下的数据2",
        status:1
    })
})



app.listen(3000);
